from flask import Flask,render_template,request
import boss
import requests
from flask import Flask
from jinja2 import Markup, Environment, FileSystemLoader
from pyecharts.globals import CurrentConfig
from pyecharts import options as opts
from pyecharts.charts import Bar


app = Flask(__name__)

CurrentConfig.GLOBAL_ENV = Environment(loader=FileSystemLoader("./templates"))

@app.route('/',methods=['GET'])
def hello_world():  # put application's code here
    return render_template('hello.html')

@app.route('/data',methods=['POST'])
def data():
    city = request.form['cities']
    keys = request.form['jobs']
    boss.boss_data(city, keys)
    c = boss.boss_dq(city,keys)
    bt = boss.boss_xl(city, keys)
    wd = boss.boss_gm(city, keys)
    zz = boss.boss_xz(city, keys)
    dt = Markup(c.render_embed())
    xl = Markup(bt.render_embed())
    gm = Markup(wd.render_embed())
    xz = Markup(zz.render_embed())

    return render_template('data.html',map=dt,education=xl,industry=gm,salary=xz,cities=city,jobs=keys)



if __name__ == '__main__':
    app.run(debug=true)
